
////////////////////////////////////////////////////////////////////////////////////////////
// 文件名: SysMenuBLL.gen.cs
//
// 模块名称: SysMenu
//
// 作者: ZXF
//
// 历史记录（记录修改记录，修改文件后请添加修改记录，注明修改时间、修改人，修改内容）:
// 2013/1/21    ZXF    创建文件
////////////////////////////////////////////////////////////////////////////////////////////

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using Model;
using DAL;
using Common;

namespace BLL
{
    /// <summary>
    /// SysMenu表业务逻辑层
    /// </summary>
    public class SysMenuBLL 
    {
        const string RightCodeInsert = "";    //添加权限编码
        const string RightCodeUpdate = "";    //修改权限编码
        const string RightCodeDelete = "";    //删除权限编码
        
        const string ErrorCodeSelect = "";    //查询异常编码
        const string ErrorCodeInsert = "";    //添加异常编码
        const string ErrorCodeUpdate = "";    //修改异常编码
        const string ErrorCodeDelete = "";    //删除异常编码

        /// <summary>
        /// 根据Id字段获取SysMenuInfo实体对象
        /// </summary>
        /// <param name="id">Id</param>
        /// <returns>SysMenuInfo实体对象</returns>
        public static SysMenuInfo GetInfoById (string id)
        {
            try
            {
                return SysMenuDAL.GetInfoById(id);
            }
            catch(Exception ex)
            {
                Logger.LogError("SysMenuBLL", "GetInfo", AppError.EROR, 0, ex, "获取SysMenu信息出错。",
                                String.Format("id = {0}", id));
                return new SysMenuInfo();
            }
        }

        /// <summary>
        /// 往SysMenu表内添加新记录
        /// </summary>
        /// <param>SysMenuInfo实体对象 <name>SysMenuInfo</name> </param>
        /// <param name="sysMenuInfo"> </param>
        /// <returns>添加记录索引值</returns>
        public int Insert(SysMenuInfo sysMenuInfo)
        { 
            try
            {
               SysMenuDAL.Insert(sysMenuInfo);
                return 1;
            }
            catch(Exception ex)
            {
                Logger.LogError("SysMenuBLL", "Insert", AppError.EROR, 0, ex, "添加SysMenu信息出错。", null);
                return 0;
            }
        }

        /// <summary>
        /// 更新SysMenu表记录
        /// </summary>
        /// <param>SysMenuInfo实体对象 <name>SysMenuInfo</name> </param>
        /// <param name="sysMenuInfo"> </param>
        public void Update(SysMenuInfo sysMenuInfo)
        {
            try
            {
                SysMenuDAL.Update(sysMenuInfo);
            }
            catch(Exception ex)
            {
                Logger.LogError("SysMenuBLL", "Update", AppError.EROR, 0, ex, "更新SysMenu信息出错。", 
                                String.Format("Id = {0}", sysMenuInfo.Id)); 
            }
        }
        
        /// <summary>
        /// 根据Id字段获取SysMenuInfo实体对象
        /// </summary>
        /// <param name="id">Id</param>
        public void Delete(string id)
        {
            try
            {
                SysMenuDAL.Delete(id);
            }
            catch(Exception ex)
            {
                Logger.LogError("SysMenuBLL", "Delete", AppError.EROR, 0, ex, "删除SysMenu信息出错。", 
                                String.Format("id = {0}", id)); 
            }
        }
        
         /// <summary>
        /// 根据Id字段获取SysMenuInfo实体对象
        /// </summary>
        /// SqlParameter[] sqlparams
        /// <returns>SysMenuInfo实体对象列表</returns>
        public static List<SysMenuInfo> GetInfoList ()
        {
            try
            { 
				return SysMenuDAL.GetInfoList();
            }
            catch(Exception ex)
            { ;
                return new List<SysMenuInfo>();
            }
        }

        public SysMenuInfo Edit(SysMenuInfo entity)
        {
            throw new NotImplementedException();
        }

        public static List<DBDeploy> GetDBList(string dbType)
        {
            try
            {
                return SysMenuDAL.GetDBList(dbType);
            }
            catch (Exception ex)
            {
                return new List<DBDeploy>();
            }
        }
        public List<DBDeploy> GetDBListInnerJob()
        {
            try
            {
                return new SysMenuDAL().GetDBListInnerJob();
            }
            catch (Exception ex)
            {
                return new List<DBDeploy>();
            }
        }
    }
}